package com.qtenv.datasync.service.controller;


import com.qtenv.datasync.base.Result;
import com.qtenv.datasync.service.service.TerminalHistoryDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 分区关联表 前端控制器
 * </p>
 *
 * @author CBL
 * @since 2022-08-02
 */
@RestController
@RequestMapping("/terminalHistoryData")
public class TerminalHistoryDataController {
    @Autowired
    private TerminalHistoryDataService terminalHistoryDataService;

    @GetMapping("/getInstantDataList")
    public Result<?> getInstantDataList(@RequestParam("tenantId") String tenantId, @RequestParam("areaId") String areaId,
                                        @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
        return Result.ok(terminalHistoryDataService.getInstantDataList(tenantId, areaId, startDate, endDate));
    }

    @GetMapping("/getHistoryDataList")
    public Result<?> getHistoryDataList(@RequestParam("tenantId") String tenantId, @RequestParam("terminalId") String terminalId,
                                        @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
        return Result.ok(terminalHistoryDataService.getHistoryDataList(tenantId, terminalId, startDate, endDate));
    }


    @GetMapping("/getSeniorMinNightFlow")
    public Result<?> getSeniorMinNightFlow(@RequestParam("tenantId") String tenantId, @RequestParam("areaId") String areaId) {
        return Result.ok(terminalHistoryDataService.getSeniorMinNightFlow(tenantId, areaId));
    }
}
